package com.hui.entity.vo;

import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.hui.entity.dao.StoreProductAttrValue;
import com.hui.util.module.customizeserializer.BigDecimalSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 商品表(StoreProduct)Vo
 */
@ApiModel(
        value = "YxStoreProductQueryVo对象",
        description = "商品表查询参数"
)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class StoreProductVo {

    @ApiModelProperty("商品id")
    private Long id;
    @ApiModelProperty("商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)")
    private Integer merId;
    @ApiModelProperty("商品图片")
    private String image;
    private String image_base;
    private String codeBase;
    @ApiModelProperty("是否收藏")
    private Boolean userCollect = false;
    @ApiModelProperty("是否喜欢")
    private Boolean userLike = false;
    @ApiModelProperty("轮播图，多个用,分割")
    private String sliderImage;
    private List<String> sliderImageArr;
    private StoreProductAttrValue attrInfo;
    @ApiModelProperty("商品名称")
    private String storeName;
    @ApiModelProperty("商品简介")
    private String storeInfo;
    @ApiModelProperty("关键字")
    private String keyword;
    @ApiModelProperty("分类id")
    private String cateId;
    @ApiModelProperty("商品价格")
    @JsonSerialize(
            using = BigDecimalSerializer.class
    )
    private BigDecimal price;
    @ApiModelProperty("会员价格")
    @JsonSerialize(
            using = BigDecimalSerializer.class
    )
    private BigDecimal vipPrice;
    @ApiModelProperty("市场价")
    @JsonSerialize(
            using = BigDecimalSerializer.class
    )
    private BigDecimal otPrice;
    @ApiModelProperty("邮费")
    @JsonSerialize(
            using = BigDecimalSerializer.class
    )
    private BigDecimal postage;
    @ApiModelProperty("单位名")
    private String unitName;
    @ApiModelProperty("排序")
    private Integer sort;
    @ApiModelProperty("销量")
    private Integer sales;
    @ApiModelProperty("库存")
    private Integer stock;
    @ApiModelProperty("产品描述")
    private String description;
    @ApiModelProperty("是否包邮")
    private Integer isPostage;
    @ApiModelProperty("成本价")
    @JsonSerialize(
            using = BigDecimalSerializer.class
    )
    private BigDecimal cost;
    @ApiModelProperty("秒杀状态 0 未开启 1已开启")
    private Integer isSeckill;
    @ApiModelProperty("砍价状态 0未开启 1开启")
    private Integer isBargain;
    @ApiModelProperty("是否优品推荐")
    private Integer isGood;
    @ApiModelProperty("虚拟销量")
    private Integer ficti;
    @ApiModelProperty("浏览量")
    private Integer browse;
    @ApiModelProperty("状态（0：未上架，1：上架）")
    private Integer isShow;
    @ApiModelProperty("获得积分")
    private BigDecimal giveIntegral;
    @ApiModelProperty("运费模板ID")
    private Integer tempId;
    @ApiModelProperty("是否单独分佣")
    private Integer isSub;
    @ApiModelProperty("规格 0单 1多 ")
    private Integer specType;
    @ApiModelProperty("是否开启积分兑换")
    private Integer isIntegral;
    @ApiModelProperty("需要多少积分")
    private Integer integral;

    public List<String> getSliderImageArr() {
        return (List) (StrUtil.isNotEmpty(this.sliderImage) ? Arrays.asList(this.sliderImage.split(",")) : new ArrayList());
    }
}
